package com.base.library.http;

import android.util.Log;

import java.io.IOException;
import java.util.Set;
import java.util.TreeSet;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

import static android.content.ContentValues.TAG;

public class SignInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        Log.d(TAG, request.toString());
        Set<String> names = new TreeSet<String>();
        names.addAll(request.url().queryParameterNames());
        StringBuffer sb = new StringBuffer();
        for (String name : names) {
            sb.append(name);
            sb.append(request.url().queryParameter(name));
        }
        Log.d(TAG, sb.toString());
        Response response = chain.proceed(request);
        return response;
    }
}
